﻿using UnityEngine;

namespace Assets.Scripts.Tutorial
{
    class TutorialController : MonoBehaviour
    {
        private int index;
        private GameObject TopMenu;
        private GameObject PersonName;
        private GameObject BottonMenu;

        void Awake()
        {
            TopMenu = this.gameObject.transform.parent.GetChild(0).gameObject;
            PersonName = this.gameObject.transform.parent.GetChild(1).gameObject;
            BottonMenu = this.gameObject.transform.parent.GetChild(2).gameObject;

            TopMenu.SetActive(false);
            PersonName.SetActive(false);
            BottonMenu.SetActive(false);

            foreach (Transform child in this.gameObject.transform)
                child.gameObject.SetActive(false);

            this.gameObject.transform.GetChild(0).gameObject.SetActive(true);
            index = 0;
        }

        public void OnNextButtonClick()
        {
            ShowGameDisplay();
            this.gameObject.transform.GetChild(index++).gameObject.SetActive(false);
            this.gameObject.transform.GetChild(index).gameObject.SetActive(true);
        }

        private void ShowGameDisplay()
        {
            if (index == 0)
                TopMenu.SetActive(true);
            else if (index == 6)
                PersonName.SetActive(true);
            else if (index == 7)
                BottonMenu.SetActive(true);
        }

        public void OnStartClick()
        {
            Application.LoadLevel("GameplayScene2");
        }
    }
}
